<div class="content_filtro">
    <div class="filtro">
        <form id="form_filtro" method="post" action="">
            <i>Pesquisar</i>
            
            <?php

                //$f_cur = new Sistema_Model_DbTable_Cursobase();
                //$f_cur = $f_cur->fetchAll('CBS_STA = 1');
                $f_cur = $this->db->fetchAll('SELECT SQL_CACHE CBS_ID,CBS_NOM FROM CURSOBASE WHERE CBS_STA = 1');
            
                $html = '<select id="itfiltro" name="itfiltro" class="chosen-select" >';
                $html .= '<option value="">Todos</option>';
                foreach($f_cur as $r){   
                    $select = $this->filtro == $r['CBS_ID'] ? 'selected':''; 
                    $html .= '<option '.$select.' value="'.$r['CBS_ID'].'">'.$r['CBS_NOM'].'</option>'; 
                }
                $html .= '</select>';
                echo $html;
                ?>
            <input type="submit" class="btn-pdr" name="buscar" value="buscar" />
        </form>
    </div>
    <?php if($this->per_add){?>
    <div class="content-btn">
        <span>Novo Curso</span><a href="<?php echo $this->url(array('controller' => $this->controller, 'action' => 'edit')); ?>">+</a>
    </div>
    <?php } ?>
</div>

<div class="content-list">
    
    <h2><?php echo $this->titulo;?></h2>
    
    <table id="tlist">
        <thead>
            <tr>
                <th>Nome</th>
                <th>Período</th>
                <th>Ordem</th>
                <th class="bc">&nbsp;</th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($this->result as $row) { ?>
                <tr>
                    <td align="left"><?php echo $row['CBS_NOM']; ?></td>
                    <td><?php $arr = dominio::TipoSemestre(); echo $arr[$row['CBS_TPOTMP']]; ?></td>
                    <td align="left"><?php echo $row['CBS_ORD']; ?></td>
                    <td class="bc">
                        <?php if($this->per_edt){?><a class="btn-pdr" href="<?php echo $this->url(array('controller' => $this->controller, 'action' => 'edit', 'id' => $row['CBS_ID'])); ?>">Editar</a><?php }?>
                        <?php if($this->per_del && $row['CBS_STA'] == 0){?><a class="btn-pdr" href="javascript:void(0);" onclick="list_delete('<?php echo $this->controller; ?>', <?php echo $row['CBS_ID'] ?>, $(this));">Deletar</a><?php } ?>
                    </td>
                </tr>
            <?php } ?>
        </tbody>
    </table>
</div>
<?php echo $this->paginationControl($this->paginator, 'Sliding', 'pagination.phtml'); ?>